/*
 * @author dumeng
 */
// 'use strict'
import request from '@/utils/request'
/**
 * 查询资源列表
 */
export function queryPage(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/areaResources/queryPage',
    method: 'post',
    data
  })
}
/**
 * 查询闯关资源列表
 */
export function queryPageReurcit(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/rushQuestions/queryPage',
    method: 'post',
    data
  })
}

/**
 * 删除资源
 */
export function del(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/areaResources/deleteByIds',
    method: 'post',
    data
  })
}

/**
 * 修改排序
 */
export function updateSort(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: 'backend/areaResources/setSort',
    method: 'post',
    data
  })
}

/**
 * 选择/新建资源
 */
export function insert(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/areaResources/insert',
    method: 'post',
    data
  })
}

/**
 * 设置资源
 */
export function updateResource(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/areaResources/update',
    method: 'post',
    data
  })
}

/**
 * 新建资源--选择直播
 */
export function queryPageLive(type, data) {
  const url = type === 'live' ? '/backend/liveActivity/queryPage' : '/backend/info/cxgzs/queryPage'
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: url,
    method: 'POST',
    data
  })
}
/**
 * 字典
 */
export function getDictByCode(dictCode) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/sysDictionary/getDictByCode',
    method: 'POST',
    data: {
      dictCode
    }
  })
}

// 获取标签
export function getCourseTag(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/courseInfo/getCourseTag',
    method: 'POST',
    data
  })
}

// 设置标签
export function setTags(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/areaResources/update',
    method: 'POST',
    data
  })
}

/**
 * 获取分类树形列表
 */
export function getClassifyTree(data, url = '/backend/learnClassify/getClassifyTree') {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: url,
    method: 'POST',
    data
  })
}
/**
 * 获取分类树形列表
 */
export function getClassifyTreeRWFL(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/sysDictionary/getDictByCode',
    method: 'POST',
    data
  })
}
